﻿using AnesSystem.Models;
using AnesSystem.Services;
using AnesSystem.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace AnesSystem.Controls
{
    /// <summary>
    /// PostoperativeAnalgesiaCtrl.xaml 的交互逻辑
    /// </summary>
    public partial class PostoperativeAnalgesiaCtrl : UserControl
    {

        #region Variables
        private static PostoperativeAnalgesiaCtrl _instance;
        
        #endregion

        #region Constructor


        public static PostoperativeAnalgesiaCtrl Instance
        {
            get
            {
                if (_instance == null)
                {
                    _instance = new PostoperativeAnalgesiaCtrl();
                }
                return _instance;
            }
        }
        public PostoperativeAnalgesiaCtrl()
        {
            InitializeComponent();
            this.DataContext = PostoperativeAnalgesiaCtrlViewModel.Instance;
        }

        #endregion

        #region Properties

        #endregion

        #region 依赖属性

        #endregion

        #region Event

        public event EventHandler<string> Excuted;

        #endregion

        #region Private Methods

        #endregion

        #region Public/Protected Methods

        #endregion

        #region EventHandlers
        private void Add_Button_Click(object sender, RoutedEventArgs e)
        {
            PostoperativeAnalgesiaCtrlViewModel.Instance.AddPosCtrl();
        }      

        #endregion

        //private void SelectSinceFilling(object sender, SelectionChangedEventArgs e)
        //{
        //    string ztfs1 = ztfs.SelectedValue as string;
        //    PostoperativeAnalgesiaCtrlViewModel.Instance.SelectSinceFilling(ztfs1);
        //}

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            string commond = (sender as Button).Tag.ToString();
            PostoperativeAnalgesiaCtrlViewModel.Instance.Excute(commond);
            Excuted?.Invoke(PostoperativeAnalgesiaCtrlViewModel.Instance.ShztXianShi, commond);
        }

    }
}
